VERSION 5.00
Object = "{C4847593-972C-11D0-9567-00A0C9273C2A}#8.0#0"; "crviewer.dll"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "msdatgrd.ocx"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmMaintPriceList 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   6630
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   12645
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   6630
   ScaleWidth      =   12645
   ShowInTaskbar   =   0   'False
   Begin ITGControls.ComunionFrames ComunionFrames2 
      Height          =   3225
      Left            =   0
      Top             =   2790
      Width           =   12480
      _ExtentX        =   22013
      _ExtentY        =   5689
      FrameColor      =   4210752
      BackColor       =   16243138
      FillColor       =   16243138
      RoundedCorner   =   0   'False
      Caption         =   "Details"
      Alignment       =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ThemeColor      =   5
      ColorFrom       =   16243138
      ColorTo         =   16250865
      Begin MSDataGridLib.DataGrid grdDetail 
         Height          =   2805
         Left            =   0
         TabIndex        =   14
         Top             =   420
         Width           =   12480
         _ExtentX        =   22013
         _ExtentY        =   4948
         _Version        =   393216
         AllowUpdate     =   -1  'True
         AllowArrows     =   -1  'True
         Enabled         =   -1  'True
         HeadLines       =   1
         RowHeight       =   15
         TabAcrossSplits =   -1  'True
         TabAction       =   2
         FormatLocked    =   -1  'True
         AllowDelete     =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   9
         BeginProperty Column00 
            DataField       =   "cCompanyId"
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "nIdentity"
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cTranNo"
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "cItemNo"
            Caption         =   "Item No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "cDesc"
            Caption         =   "Description"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "nOldPrice"
            Caption         =   "Old SR Price"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column06 
            DataField       =   "nNewPrice"
            Caption         =   "New SR Price"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column07 
            DataField       =   "nWSOldPrice"
            Caption         =   "Old WS Price"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column08 
            DataField       =   "nWSNewPrice"
            Caption         =   "New WS Price"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               Object.Visible         =   0   'False
            EndProperty
            BeginProperty Column01 
               Object.Visible         =   0   'False
            EndProperty
            BeginProperty Column02 
               Object.Visible         =   0   'False
            EndProperty
            BeginProperty Column03 
               Locked          =   -1  'True
               ColumnWidth     =   1574.929
            EndProperty
            BeginProperty Column04 
               Locked          =   -1  'True
               ColumnWidth     =   3869.858
            EndProperty
            BeginProperty Column05 
               Alignment       =   1
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column06 
               Alignment       =   1
            EndProperty
            BeginProperty Column07 
               Alignment       =   1
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column08 
               Alignment       =   1
            EndProperty
         EndProperty
      End
   End
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   17
      Top             =   6345
      Width           =   12645
      _ExtentX        =   22304
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   9077
            MinWidth        =   2
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin ITGControls.ITGTextBox ITGcCategory 
      Height          =   285
      Left            =   5265
      TabIndex        =   18
      Top             =   5625
      Width           =   1125
      _ExtentX        =   1773
      _ExtentY        =   503
      LabelBackColor  =   16243138
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Label           =   "Category"
      BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      LabelWidth      =   800
      TextBoxWidth    =   265
   End
   Begin ITGControls.ITGTab SSTab1 
      Height          =   6015
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   12480
      _ExtentX        =   22013
      _ExtentY        =   10610
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      InActiveTabForeColor=   0
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483630
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   2490
         Left            =   -75000
         TabIndex        =   15
         Top             =   315
         Width           =   12480
         _ExtentX        =   22013
         _ExtentY        =   4392
         _Version        =   393216
         HeadLines       =   1
         RowHeight       =   15
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   4
         BeginProperty Column00 
            DataField       =   "cTranNo"
            Caption         =   "Transaction Id"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "dDate"
            Caption         =   "Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cCategory"
            Caption         =   "Category"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "dEffectDate"
            Caption         =   "Effectivity Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column02 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column03 
               Locked          =   -1  'True
            EndProperty
         EndProperty
      End
      Begin CRVIEWERLibCtl.CRViewer ITGReportViewer 
         Height          =   6200
         Left            =   -74940
         TabIndex        =   16
         Top             =   360
         Visible         =   0   'False
         Width           =   10500
         lastProp        =   500
         _cx             =   5080
         _cy             =   5080
         DisplayGroupTree=   0   'False
         DisplayToolbar  =   -1  'True
         EnableGroupTree =   0   'False
         EnableNavigationControls=   -1  'True
         EnableStopButton=   -1  'True
         EnablePrintButton=   -1  'True
         EnableZoomControl=   -1  'True
         EnableCloseButton=   -1  'True
         EnableProgressControl=   -1  'True
         EnableSearchControl=   -1  'True
         EnableRefreshButton=   0   'False
         EnableDrillDown =   -1  'True
         EnableAnimationControl=   -1  'True
         EnableSelectExpertButton=   0   'False
         EnableToolbar   =   -1  'True
         DisplayBorder   =   0   'False
         DisplayTabs     =   0   'False
         DisplayBackgroundEdge=   -1  'True
         SelectionFormula=   ""
         EnablePopupMenu =   -1  'True
         EnableExportButton=   -1  'True
         EnableSearchExpertButton=   0   'False
         EnableHelpButton=   0   'False
         LaunchHTTPHyperlinksInNewBrowser=   -1  'True
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   2505
         Left            =   0
         Top             =   315
         Width           =   12480
         _ExtentX        =   22013
         _ExtentY        =   4419
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Header Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   3060
            Top             =   465
         End
         Begin VB.Frame Frame2 
            BackColor       =   &H00F7D9C2&
            Height          =   1395
            Left            =   1320
            TabIndex        =   20
            Top             =   945
            Width           =   3495
            Begin VB.OptionButton optbPrcntg 
               BackColor       =   &H00F7D9C2&
               Caption         =   "by Percentage"
               Height          =   255
               Left            =   120
               TabIndex        =   4
               Top             =   240
               Width           =   1455
            End
            Begin VB.OptionButton optbAmount 
               BackColor       =   &H00F7D9C2&
               Caption         =   "by Amount"
               Height          =   255
               Left            =   120
               TabIndex        =   5
               Top             =   600
               Width           =   1455
            End
            Begin VB.OptionButton optbSelItem 
               BackColor       =   &H00F7D9C2&
               Caption         =   "by Selected Item"
               Height          =   255
               Left            =   120
               TabIndex        =   6
               Top             =   960
               Width           =   1695
            End
            Begin ITGControls.ITGTextBox txtByPrcntg 
               Height          =   285
               Left            =   2040
               TabIndex        =   7
               Top             =   240
               Width           =   975
               _ExtentX        =   1614
               _ExtentY        =   503
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               Label           =   "ITGtext"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   915
            End
            Begin ITGControls.ITGTextBox txtByAmount 
               Height          =   285
               Left            =   2040
               TabIndex        =   8
               Top             =   600
               Width           =   975
               _ExtentX        =   1614
               _ExtentY        =   503
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               Label           =   "ITGtext"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   915
            End
         End
         Begin VB.Frame Frame3 
            BackColor       =   &H00F7D9C2&
            Caption         =   " Category "
            Height          =   1395
            Left            =   5280
            TabIndex        =   19
            Top             =   945
            Width           =   5235
            Begin VB.ComboBox cmbcCategory 
               Height          =   315
               ItemData        =   "frmMaintPriceList.frx":0000
               Left            =   1800
               List            =   "frmMaintPriceList.frx":000A
               Style           =   2  'Dropdown List
               TabIndex        =   9
               Top             =   360
               Width           =   1995
            End
            Begin VB.CommandButton cmbFrom 
               BeginProperty Font 
                  Name            =   "MS Sans Serif"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   300
               Left            =   2205
               Picture         =   "frmMaintPriceList.frx":002E
               Style           =   1  'Graphical
               TabIndex        =   11
               Top             =   900
               Width           =   315
            End
            Begin VB.CommandButton cmbTo 
               BeginProperty Font 
                  Name            =   "MS Sans Serif"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   300
               Left            =   4710
               Picture         =   "frmMaintPriceList.frx":0178
               Style           =   1  'Graphical
               TabIndex        =   13
               Top             =   900
               Width           =   315
            End
            Begin ITGControls.ITGTextBox ITGcDivisionFrom 
               Height          =   285
               Left            =   180
               TabIndex        =   10
               Top             =   900
               Width           =   1995
               _ExtentX        =   3307
               _ExtentY        =   503
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   " From"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   600
               TextBoxWidth    =   1335
            End
            Begin ITGControls.ITGTextBox ITGcDivisionTo 
               Height          =   285
               Left            =   3000
               TabIndex        =   12
               Top             =   900
               Width           =   1680
               _ExtentX        =   2752
               _ExtentY        =   503
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "To"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   300
               TextBoxWidth    =   1320
            End
         End
         Begin ITGControls.ITGTextBox ITGcTranNo 
            Height          =   285
            Left            =   240
            TabIndex        =   1
            Top             =   525
            Width           =   2820
            _ExtentX        =   4763
            _ExtentY        =   503
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Transaction Id"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1300
            TextBoxWidth    =   1460
            Required        =   -1  'True
         End
         Begin ITGControls.ITGDateBox ITGdDate 
            Height          =   285
            Left            =   7560
            TabIndex        =   2
            Top             =   525
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
         End
         Begin ITGControls.ITGDateBox ITGdEffectDate 
            Height          =   285
            Left            =   10560
            TabIndex        =   3
            Top             =   525
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Effectivity Date"
            Height          =   195
            Left            =   9300
            TabIndex        =   22
            Top             =   555
            Width           =   1125
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date"
            Height          =   195
            Left            =   7080
            TabIndex        =   21
            Top             =   570
            Width           =   345
         End
      End
   End
End
Attribute VB_Name = "frmMaintPriceList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'IT Group Inc. 2005.09.23

Option Explicit

'Object variables





'Recordset variables
Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsDetail As ADODB.Recordset

'Form mode enumeration
Enum ePLMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As ePLMode

'Other declarations
Dim bEdit As Boolean
Dim bDelLine As Boolean

Public dtgName As String
Public sBit As String

'Security Acess Level variables
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Private Sub cmbcCategory_Click()
    If cmbcCategory.Text = "Product Division" Then
        rsDetail.Requery
        cmbFrom.Enabled = True
        cmbTo.Enabled = True
        ITGcDivisionFrom.Locked = False
        ITGcDivisionTo.Locked = False
    End If
End Sub

Private Sub cmbcCategory_KeyPress(KeyAscii As Integer)
    If Not cmbcCategory.Text = "" Then
        If KeyAscii = 13 Then
            If cmbcCategory.Text = "Product Division" Then
                cmbFrom_Click
            Else
                grdDetail.SetFocus
                grdDetail.Col = 6
            End If
        End If
    End If
End Sub

Private Sub cmbFrom_Click()
    If lPickListActive Then Exit Sub
    frmITGPickList.mType = ProductDivision
    frmITGPickList.Show vbModal
    If Not frmITGPickList.mCode = "" Then
        ITGcDivisionFrom.Text = frmITGPickList.mCode
    End If
    cmbTo.SetFocus
End Sub

Private Sub cmbTo_Click()
    If lPickListActive Then Exit Sub
    frmITGPickList.mType = ProductDivision
    frmITGPickList.Show vbModal
    If Not frmITGPickList.mCode = "" Then
        ITGcDivisionTo.Text = frmITGPickList.mCode
        ITGcDivisionTo.SetFocus
    End If
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

Private Sub Form_Load()
        
    Set FrmName = Me
    FormSetup
    
    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'MF20'")
    
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset
    optbPrcntg.Value = True
    
    If optbPrcntg.Value = True Then
        txtByAmount.Enabled = False
    Else
        txtByPrcntg.Enabled = True
    End If

    Mode = Find
    
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    
    
End Sub

Private Sub Form_Activate()
    BitVisible ITGLedgerMain.tbrMain, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    TBBitReload
    Set FrmName = Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    bEdit = False
    
    
    
    
    
    Set rsHeader = Nothing
    Set rsDetail = Nothing
End Sub

Public Sub TBNew()
    Mode = AddNewEdit
    
    ClearCategory
    
    OpenRecordset rsHeader, "*", "PRICELIST", "where 1=0", False
    OpenRecordset rsDetail, "*", "PRICELIST_T", , False

    SetDataField
    BindControls rsHeader
    Set grdDetail.DataSource = rsDetail
    Set dtgList.DataSource = rsHeader
    
    rsHeader.AddNew
    rsHeader!cCompanyID = COID
    rsHeader!dDate = Date$

    FilterDet
    
    ITGcTranNo.Enabled = True
    ITGcTranNo.Text = ""
    ITGcTranNo.SetFocus
    bEdit = False

    FormLocking False
    ClrRequired &HC0&
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    
    cmbFrom.Enabled = False
    cmbTo.Enabled = False
    ITGcDivisionFrom.Locked = True
    ITGcDivisionTo.Locked = True
    ITGcTranNo.BackColor = &HE0FFFF
End Sub

Public Sub TBNewLine()
    If Mode <> AddNewEdit Then Exit Sub
    If cmbcCategory.Text = "Product Division" Then
        RepName = "and cPDCode between '" & Trim(ITGcDivisionFrom.Text) & "' and '" & Trim(ITGcDivisionTo.Text) & "' "
        If Mode <> AddNewEdit Then Exit Sub
        If lPickListActive Then Exit Sub
        frmITGPickList.mType = Item
        frmITGPickList.Show vbModal

        grdDetail.SetFocus
        grdDetail.Col = 6
'        If rsDetail.RecordCount <> 0 Then
'            grdDetail.Columns(6).Value = 0#
'            grdDetail.Columns(8).Value = 0#
'        End If
         ComputeDetail
         
    ElseIf cmbcCategory.Text = "All/Selected" Then
        rsDetail.Requery
        If Mode <> AddNewEdit Then Exit Sub
        If lPickListActive Then Exit Sub
        frmITGPickList.mType = Item
        frmITGPickList.Show vbModal
        
        ComputeDetail
        
        cmbFrom.Enabled = False
        cmbTo.Enabled = False
        ITGcDivisionFrom.Locked = True
        ITGcDivisionTo.Locked = True
    End If
End Sub

Public Sub TBDeleteLine()
'REMOVING ROW DETAIL
On Error Resume Next
    Set rs = Nothing
    Set rsDetail = rs.Clone
    
    vBookMark = grdDetail.Bookmark
    FilterDet   ' to avoid 0 recordset recordcount
    grdDetail.Bookmark = vBookMark
    rsDetail.Delete adAffectCurrent
    FilterDet   ' to avoid 0 recordset recordcount
End Sub

Public Sub TBEdit()
    
    If rsHeader!lPosted = True Then
        MsgBox "Transaction was already posted. Edit is not allowed.", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    Mode = AddNewEdit
    bEdit = True

    ITGcTranNo.Enabled = False

    FilterDet
    PanelStat
    
    FormLocking False
    ClrRequired &HC0&
    cmbcCategory.Enabled = False
    ITGcDivisionFrom.Locked = True
    ITGcDivisionTo.Locked = True
    cmbFrom.Enabled = False
    cmbTo.Enabled = False
    'Frame2.Enabled = False
    Frame3.Enabled = False
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
End Sub

Public Sub TBDelete()
On Error GoTo ErrorHandler
    
    SSTab1.TabEnabled(1) = True
    
    If rsHeader!lPosted = True Then
        MsgBox "Transaction was already posted. Deletion is not allowed.", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    If MsgBox("This will permanently remove the Record. Continue to Delete?", vbQuestion Or vbYesNo) = vbYes Then

        sID = Trim(ITGcTranNo)
        FilterDet

         If Not rsDetail.RecordCount = 0 Then
             rsDetail.MoveFirst
             Do While Not rsDetail.EOF
                rsDetail.Delete adAffectCurrent
                rsDetail.UpdateBatch adAffectAll
                rsDetail.MoveNext
             Loop

         End If

            'Audit trail
            UpdateLogFile "Price List", Trim(ITGcTranNo), "Deleted"
            rsHeader.Delete adAffectCurrent
            rsHeader.UpdateBatch adAffectAll
            
        End If

    
    bEdit = False
    TBPrevRec
    CodeCombo
    
    If Not rsHeader.RecordCount = 0 Then
        Mode = Normal
    End If
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , lACPost, , , , True, True, , True

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        cn.Execute "DELETE PRICELIST_T WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE PRICELIST WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
    End If

End Sub

Public Sub TBSave()
On Error GoTo ErrHandler
Dim OKUpdate As Boolean

    'Audit Trail
    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True
    
    SSTab1.TabEnabled(1) = True
    CodeControl
    
    If Not rsDetail.RecordCount = 0 Then
        rsDetail.MoveFirst
        Do While Not rsDetail.EOF
            If rsHeader.Status = adRecNew Then
                If optbPrcntg.Value = True Then
                    If rsDetail!nNewPrice = 0# Then rsDetail!nNewPrice = rsDetail!nOldPrice + (rsDetail!nOldPrice * (txtByPrcntg / 100))
                    If rsDetail!nWSNewPrice = 0# Then rsDetail!nWSNewPrice = rsDetail!nWSOldPrice + (rsDetail!nWSOldPrice * (txtByPrcntg / 100))
                End If
                If optbAmount.Value = True Then
                    If rsDetail!nNewPrice = 0# Then rsDetail!nNewPrice = rsDetail!nOldPrice + txtByAmount
                    If rsDetail!nWSNewPrice = 0# Then rsDetail!nWSNewPrice = rsDetail!nWSOldPrice + txtByAmount
                End If
            Else
                If optbPrcntg.Value = True Then
                    rsDetail!nNewPrice = rsDetail!nNewPrice + (rsDetail!nNewPrice * (txtByPrcntg / 100))
                    rsDetail!nWSNewPrice = rsDetail!nWSNewPrice + (rsDetail!nWSNewPrice * (txtByPrcntg / 100))
                End If
                If optbAmount.Value = True Then
                    rsDetail!nNewPrice = rsDetail!nNewPrice + txtByAmount
                    rsDetail!nWSNewPrice = rsDetail!nWSNewPrice + txtByAmount
                End If
            End If
            rsDetail.MoveNext
        Loop
    End If
    
    
    
    If ITGcTranNo.Text = "" Then
        MsgBox "Primary Id cannot be null.", vbCritical + vbOKOnly, "ALERT"
        ITGcTranNo.SetFocus
        Exit Sub
    End If
    If ITGdEffectDate.Text = "__/__/____" Then
        MsgBox "Effectivity Date cannot be null.", vbCritical + vbOKOnly, "ALERT"
        ITGdEffectDate.SetFocus
        Exit Sub
    End If
    If ITGcCategory.Text = "" Then
        MsgBox "Cateogry cannot be null.", vbCritical + vbOKOnly, "ALERT"
        ITGcCategory.SetFocus
        Exit Sub
    End If
    If rsDetail.RecordCount = 0 Then
        MsgBox "No Item/s to be saved.", vbCritical + vbOKOnly, "ALERT"
        Exit Sub
    End If
    
    OKUpdate = False
    
    cn.BeginTrans

        If Not rsDetail.RecordCount = 0 Then
            rsDetail.UpdateBatch adAffectAll
        End If

        rsHeader.UpdateBatch adAffectAll
        If Mode = AddNewEdit Then
            rsHeader.UpdateBatch adAffectCurrent
        End If

    cn.CommitTrans

    OKUpdate = True
    Mode = Normal
    FilterDet

    MsgBox "Record/s successfully save.", vbInformation + vbOKOnly, "SAVE"
 
    'Audit trail
    UpdateLogFile "Price List", Trim(ITGcTranNo), IIf(lBoolean, "Inserted", "Updated")
    
    bDelLine = False
    bEdit = False
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , lACPost, , , , True, True, , True
    Frame2.Enabled = True
    Frame3.Enabled = True
    
ErrHandler:
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, "ITG Ledger"
        cn.RollbackTrans
    End If
End Sub

Public Sub TBFindPrimary()

        If Mode = Find Then
        
            FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."

            Set rsHeader = Nothing
            Set rsDetail = Nothing
            Set rsHeader = New ADODB.Recordset
            Set rsDetail = New ADODB.Recordset
            
            If Trim(ITGcTranNo) = "" Then
                OpenRecordset rsHeader, "*", "PRICELIST", , False
                OpenRecordset rsDetail, "*", "PRICELIST_T", , False
            Else
                OpenRecordset rsHeader, "*", "PRICELIST", "where cTranno LIKE '" & Trim(ITGcTranNo.Text) & "' ", False
                OpenRecordset rsDetail, "*", "PRICELIST_T", "where cTranno LIKE '" & Trim(ITGcTranNo.Text) & "' ", False
            End If
            
            
            If Not rsHeader.RecordCount = 0 Then
                SetDataField
                BindControls rsHeader
                'Set dtgList.DataSource = rsHeader
                Set grdDetail.DataSource = rsDetail
                FilterDet
                CodeCombo
                
                Mode = Normal
                BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , lACPost, , , , True, True, , True
                ITGcTranNo.Locked = True
                ITGcTranNo.BackColor = &HE0FFFF
                FormWaitHide
            Else
                FormWaitHide
                'MsgBox "No record/s found.", vbCritical + vbOKOnly, "ALERT"
                MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
                ITGcTranNo.SetFocus
                Exit Sub
            End If
    Else

    Set grdDetail.DataSource = Nothing
    grdDetail.Refresh

    Set FrmName = Me
    UnbindControls
    TextClearing

    If rsHeader.State = adStateOpen Then rsHeader.Close
    
    Mode = Find
    FormLocking True
    
    ITGcTranNo.Enabled = True
    ITGcTranNo.Locked = False
    ITGcTranNo.SetFocus
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    End If
End Sub

Public Sub TBUndoAll()
On Error Resume Next
    rsHeader.Requery
    rsDetail.Requery
    
    If rsHeader.RecordCount = 0 Then
        ClearCategory
        ITGcTranNo.Text = ""
    End If

    If Mode = AddNewEdit Then
        If Not rsHeader.RecordCount = 0 Then
            BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True
        Else
            BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , lACPost, , , , True, True, , True
        End If
    Else
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , lACPost, , , , True, True, , True
    End If

    Mode = Normal
    FilterDet
    CodeCombo

    bEdit = False
    FormLocking True
End Sub

Public Sub TBFirstRec()
    rsHeader.MoveFirst
    FilterDet
    CodeCombo
End Sub

Public Sub TBPrevRec()
    If Not rsHeader.BOF Then rsHeader.MovePrevious
    If rsHeader.BOF And rsHeader.RecordCount > 0 Then
        Beep
        rsHeader.MoveFirst
    End If
    FilterDet
    CodeCombo
End Sub

Public Sub TBNextRec()
    If Not rsHeader.EOF Then rsHeader.MoveNext
    If rsHeader.EOF And rsHeader.RecordCount > 0 Then
        Beep
        rsHeader.MoveLast
    End If
    FilterDet
    CodeCombo
End Sub

Public Sub TBLastRec()
    rsHeader.MoveLast
    FilterDet
    CodeCombo
End Sub

Public Sub TBCloseWindow()
    Unload Me
End Sub

Public Sub SetDataField()
    ITGcTranNo.DataField = rsHeader!cTranNo
    ITGdDate.DataField = rsHeader!dDate
    ITGcCategory.DataField = rsHeader!cCategory
    ITGdEffectDate.DataField = rsHeader!dEffectDate
    ITGcDivisionFrom.DataField = rsHeader!cDivisionFrm
    ITGcDivisionTo.DataField = rsHeader!cDivisionTo
End Sub

Public Sub FilterDet()
'FILTERING DETAIL BY HEADER
On Error Resume Next
    rsDetail.Filter = "cTranNo = '" & ITGcTranNo.Text & "' "
    'PanelStat
End Sub

Public Sub PanelStat()
    
    If rsHeader.AbsolutePosition = adPosUnknown Then
        sbRS.Panels(1).Text = "Record: 0/0"
        ClearCategory
    ElseIf Not rsHeader.AbsolutePosition = adPosUnknown Then
        sbRS.Panels(1).Text = "Record: " + Str(rsHeader.AbsolutePosition) + "/" + Str(rsHeader.RecordCount)
    Else
        sbRS.Panels(1).Text = "Record: 0/0"
        ClearCategory
    End If

    If Mode = AddNewEdit Then
        Select Case rsHeader.Status
            Case adRecNew
                sbRS.Panels(2) = "Mode: New"
            Case adRecModified
                sbRS.Panels(2) = "Mode: Modify"
            Case 8
                sbRS.Panels(2) = "Mode: Modify"
            Case Else
                sbRS.Panels(2) = "Mode: Normal"
        End Select
    ElseIf Mode = Find Then
        sbRS.Panels(2) = "Mode: Find"
    Else
        sbRS.Panels(2) = "Mode: Normal"
    End If
End Sub

Private Sub grdDetail_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub grdDetail_KeyPress(KeyAscii As Integer)
    If Not grdDetail.Col = 8 Then If KeyAscii = 13 Then SendKeys "{Tab}"
End Sub

Private Sub grdDetail_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub ITGcTranNo_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If Mode = Find Then
        
            FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."

            Set rsHeader = Nothing
            Set rsDetail = Nothing
            Set rsHeader = New ADODB.Recordset
            Set rsDetail = New ADODB.Recordset
            
            If Trim(ITGcTranNo) = "" Then
                OpenRecordset rsHeader, "*", "PRICELIST", , False
                OpenRecordset rsDetail, "*", "PRICELIST_T", , False
            Else
                OpenRecordset rsHeader, "*", "PRICELIST", "where cTranno LIKE '" & Trim(ITGcTranNo.Text) & "' ", False
                OpenRecordset rsDetail, "*", "PRICELIST_T", "where cTranno LIKE '" & Trim(ITGcTranNo.Text) & "' ", False
            End If
            
            
            If Not rsHeader.RecordCount = 0 Then
                SetDataField
                BindControls rsHeader
                Set dtgList.DataSource = rsHeader
                Set grdDetail.DataSource = rsDetail
                FilterDet
                CodeCombo
                
                Mode = Normal
                BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , lACPost, , , , True, True, , True
                ITGcTranNo.Locked = True
                ITGcTranNo.BackColor = &HE0FFFF
                FormWaitHide
            Else
                FormWaitHide
                'MsgBox "No record/s found.", vbCritical + vbOKOnly, "ALERT"
                MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
                ITGcTranNo.SetFocus
                Exit Sub
            End If
        Else
            SendKeys "{Tab}"
        End If
    End If
End Sub

Private Sub ITGcTranNo_Validate(Cancel As Boolean)
Dim vStr As String
    If Not Mode = Find Then
        If Not ITGcTranNo.Text = "" Then
            If Not bEdit Then
                ITGcTranNo = Trim(ITGcTranNo)
                vStr = GetValueFrTable("cTranNo", "PRICELIST", " cTranno = '" & ITGcTranNo.Text & "' ", True)
                If Not vStr = "" Then
                    If ITGcTranNo.Locked = False And ITGcTranNo.Enabled = True Then
                        MsgBox vStr + " already exist.", vbCritical + vbOKOnly, "ALERT"
                        ITGcTranNo.SetFocus
                        Cancel = True
                        Exit Sub
                    End If
                End If
            End If
        Else
            Cancel = True
        End If
    End If
End Sub

Private Sub ITGdDate_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If Not ITGdDate.Text = "__/__/____" Then
            SendKeys "{Tab}"
        End If
    End If
End Sub

Public Sub CallPickList()
    If Mode = AddNewEdit Then
        If lPickListActive Then Exit Sub
        sFilterString = Trim(grdDetail.Columns(3).Text)
        frmITGPicker.zType = QAccounts
        frmITGPicker.Show vbModal
        If Not frmITGPicker.zCode = "" Then
            grdDetail.Columns(3).Text = frmITGPicker.zCode
            grdDetail.Columns(4).Text = frmITGPicker.zName
        End If
    End If
End Sub

Public Sub CodeCombo()
    If rsHeader.State = adStateOpen Then
        If Not rsHeader.RecordCount = 0 Then
            If rsHeader!cCategory = "All/Selected" Then
                cmbcCategory.Text = "All/Selected"
            ElseIf rsHeader!cCategory = "Product Division" Then
                cmbcCategory.Text = "Product Division"
            End If
        Else
            ClearCategory
        End If
    End If
End Sub

Public Sub CodeControl()
    If cmbcCategory.Text = "All/Selected" Then
        rsHeader!cCategory = "All/Selected"
    ElseIf cmbcCategory.Text = "Product Division" Then
        rsHeader!cCategory = "Product Division"
    End If
End Sub

Private Sub ITGdEffectDate_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If Not ITGdEffectDate.Text = "__/__/____" Then
            SendKeys "{Tab}"
        End If
    End If
End Sub

Private Sub optbAmount_Click()
On Error GoTo ErrorHandler
    If optbAmount.Value = True Then
        txtByAmount.Enabled = True
        
         If Not rsDetail.RecordCount = 0 Then
             rsDetail.MoveFirst
             Do While Not rsDetail.EOF
                rsDetail.Delete  'adAffectCurrent
                rsDetail.MoveNext
             Loop
         End If
         
    Else
        txtByAmount.Enabled = False
    End If

ErrorHandler:
    If optbPrcntg.Value = False Then
        txtByPrcntg.Enabled = False
        txtByPrcntg.Text = 0
    Else
        txtByPrcntg.Enabled = True
    End If
End Sub

Private Sub optbAmount_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then SendKeys "{Tab}"
End Sub

Private Sub optbPrcntg_Click()
On Error GoTo ErrHandler
    If optbPrcntg.Value = True Then
        txtByPrcntg.Enabled = True
    
         If Not rsDetail.RecordCount = 0 Then
             rsDetail.MoveFirst
             Do While Not rsDetail.EOF
                rsDetail.Delete  'adAffectCurrent
                rsDetail.MoveNext
             Loop
         End If
            
    Else
        txtByPrcntg.Enabled = False
    End If
    
ErrHandler:
    If optbAmount.Value = True Then
        txtByAmount.Enabled = True
    Else
        txtByAmount.Enabled = False
        txtByAmount.Text = 0
End If
End Sub

Private Sub optbPrcntg_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then SendKeys "{Tab}"
End Sub

Private Sub optbSelItem_Click()
    If optbSelItem.Value = True Then
        grdDetail.Columns(6).Locked = False
        grdDetail.Columns(8).Locked = False
    End If
End Sub

Private Sub optbSelItem_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then SendKeys "{Tab}"
End Sub

Private Sub SSTab1_Click()
    If SSTab1.ActiveTab = 1 Then
        FilterDet
        CodeCombo
    End If
End Sub

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab1.TabEnabled(1) = False
    Else
        SSTab1.TabEnabled(1) = True
    End If
    
    If Mode <> Find Then Exit Sub
    If ITGcTranNo.BackColor = &HE0FFFF Then
        ITGcTranNo.BackColor = &HE0E0E0
        Exit Sub
    End If
    If ITGcTranNo.BackColor <> &HE0FFFF Then
        ITGcTranNo.BackColor = &HE0FFFF
        Exit Sub
    End If
End Sub

Public Sub ClearCategory()
    With cmbcCategory
        .Clear
        .AddItem "All/Selected"
        .AddItem "Product Division"
    End With
End Sub

Public Sub AddDetailsFromList()
    FilterDet
    With frmITGPickList.lvwList
        For i = 1 To .ListItems.Count
            If .ListItems(i).Checked = True Then
                rsDetail.AddNew
                rsDetail!cCompanyID = COID
                rsDetail!cTranNo = ITGcTranNo.Text
                rsDetail!cItemNo = Trim(.ListItems(i).Text)
                rsDetail!cDesc = Trim(.ListItems(i).SubItems(1))
                rsDetail!nOldPrice = CDbl(.ListItems(i).SubItems(2))
                rsDetail!nNewPrice = 0#
                rsDetail!nWSOldPrice = CDbl(.ListItems(i).SubItems(3))
                rsDetail!nWSNewPrice = 0#
            End If
        Next i
    End With
    FilterDet
    If rsDetail.RecordCount <> 0 Then grdDetail.Columns(6).Value = 0#
End Sub

Public Sub ProductDiv()
Dim rsItem As ADODB.Recordset
    FilterDet
    Set rsItem = New ADODB.Recordset
    rsItem.Open "SELECT cItemNo, cDesc, nSRPrice, nWSPrice FROM ITEM WHERE cCompanyId = '" & COID & "' and cPDCode between '" & Trim(ITGcDivisionFrom.Text) & "' and '" & Trim(ITGcDivisionTo.Text) & "' ", cn, adOpenKeyset
    
    With rsItem
        If Not .RecordCount = 0 Then
            .MoveFirst
            Do While Not .EOF
                rsDetail.AddNew
                rsDetail!cCompanyID = COID
                rsDetail!cTranNo = ITGcTranNo.Text
                rsDetail!cItemNo = !cItemNo
                rsDetail!cDesc = !cDesc
                rsDetail!nOldPrice = CDbl(!nSRPrice)
                rsDetail!nNewPrice = 0#
                rsDetail!nWSOldPrice = CDbl(!nWSPrice)
                rsDetail!nWSNewPrice = 0#
                
                .MoveNext
            Loop
        End If
    End With
    FilterDet
    
    If rsDetail.RecordCount <> 0 Then grdDetail.Columns(6).Value = 0#
End Sub

Private Sub txtByAmount_KeyPress(KeyAscii As Integer)
    If KeyAscii = 0 Then SendKeys "{Tab}" 'enter keyascii = 0
End Sub

Private Sub txtByPrcntg_KeyPress(KeyAscii As Integer)
    If KeyAscii = 0 Then SendKeys "{Tab}" 'enter keyascii = 0
End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
End Sub


'Post current record
Public Sub TBPostRecord()
On Error GoTo TheSource
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Posting is not allowed", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    If rsHeader!lApproved = True Then
        MsgBox "Transaction was already Posted.", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to post this record?", vbQuestion + vbYesNo, "ComUnion") = vbNo Then Exit Sub

    'Audit trail
    UpdateLogFile "Price List", Trim(ITGcTranNo), "Posted"

    'Update PL Activity
    UpdateGLA "Update", "PL", Trim(ITGcTranNo)
    
    'cn.Execute ("UPDATE PRICELIST SET lApproved = 1 WHERE cTranNo = '" & Trim(ITGcTranNo) & "' AND cCompanyID = '" & COID & "'")
    
    If Not rsDetail.RecordCount = 0 Then
        rsDetail.MoveFirst
        Do While Not rsDetail.EOF
            cn.Execute ("UPDATE ITEM SET nSRPrice = '" & Trim(rsDetail!nNewPrice) & "', " & _
                "nWSPrice = '" & Trim(rsDetail!nWSNewPrice) & "'  " & _
                "WHERE cItemNo = '" & Trim$(rsDetail!cItemNo) & "' AND cCompanyID = '" & COID & "' ")
            rsDetail.MoveNext
        Loop
    End If
    
    sbRS.Panels(5) = "POSTED"
    Mode = Normal
    
    rsHeader!lPosted = True
    rsHeader.UpdateBatch adAffectAll

TheSource:
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler
    
    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount
        
        If rsHeader.Status <> adRecNew Then
            ITGcTranNo.Locked = True
        Else
            ITGcTranNo.Locked = False
        End If
        
        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else
            sbRS.Panels(2) = ""
        End If
        
        FilterDet
    
        If rsHeader!lCancelled = True Then
            sbRS.Panels(5) = "CANCELLED"
        ElseIf rsHeader!lPosted = True Then
            sbRS.Panels(5) = "POSTED"
        Else
            sbRS.Panels(5) = ""
        End If
        
    Else
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        ITGcTranNo.Locked = False
    End If
    

ErrorHandler:
    'Err.Number -2147217885
    'Description - Row handle referred to a deleted row or a row marked for deletion.
    If err.Number = -2147217885 Then
        Resume Next
    End If
    
End Sub

Private Sub ComputeDetail()
    If Not rsDetail.RecordCount = 0 Then
        rsDetail.MoveFirst
        Do While Not rsDetail.EOF
            If rsHeader.Status = adRecNew Then
                If optbPrcntg.Value = True Then
                    If rsDetail!nNewPrice = 0# Then rsDetail!nNewPrice = rsDetail!nOldPrice + (rsDetail!nOldPrice * (txtByPrcntg / 100))
                    If rsDetail!nWSNewPrice = 0# Then rsDetail!nWSNewPrice = rsDetail!nWSOldPrice + (rsDetail!nWSOldPrice * (txtByPrcntg / 100))
                End If
                If optbAmount.Value = True Then
                    If rsDetail!nNewPrice = 0# Then rsDetail!nNewPrice = rsDetail!nOldPrice + txtByAmount
                    If rsDetail!nWSNewPrice = 0# Then rsDetail!nWSNewPrice = rsDetail!nWSOldPrice + txtByAmount
                End If
            Else
                If optbPrcntg.Value = True Then
                    rsDetail!nNewPrice = rsDetail!nNewPrice + (rsDetail!nNewPrice * (txtByPrcntg / 100))
                    rsDetail!nWSNewPrice = rsDetail!nWSNewPrice + (rsDetail!nWSNewPrice * (txtByPrcntg / 100))
                End If
                If optbAmount.Value = True Then
                    rsDetail!nNewPrice = rsDetail!nNewPrice + txtByAmount
                    rsDetail!nWSNewPrice = rsDetail!nWSNewPrice + txtByAmount
                End If
            End If
            rsDetail.MoveNext
        Loop
    End If
End Sub




